/*
 * Copyright 2015-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.dcp.jeedcp.modules.report.entity.datasource;

import org.hibernate.validator.constraints.Length;

import com.dcp.jeedcp.common.persistence.DataEntity;
import com.dcp.jeedcp.common.utils.excel.annotation.ExcelField;

/**
 * 数据源设置Entity
 * @author henry
 * @version 2017-05-12
 */
public class Datasource extends DataEntity<Datasource> {
	
	private static final long serialVersionUID = 1L;
	private String name;		// 数据源名称
	private String driverClass;		// 数据源驱动类
	private String jdbcUrl;		// 数据源连接字符串(JDBC)
	private String user;		// 数据源登录用户名
	private String password;		// 数据源登录密码
	private String queryerClass;		// 获取报表引擎查询器类名
	private String poolClass;		// 报表引擎查询器使用的数据源连接池类名
	private String options;		// 数据源配置选项(JSON格式）
	
	public Datasource() {
		super();
	}

	public Datasource(String id){
		super(id);
	}

	@Length(min=1, max=50, message="数据源名称长度必须介于 1 和 50 之间")
	@ExcelField(title="数据源名称", align=2, sort=1)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Length(min=1, max=100, message="数据源驱动类长度必须介于 1 和 100 之间")
	@ExcelField(title="数据源驱动类", align=2, sort=2)
	public String getDriverClass() {
		return driverClass;
	}

	public void setDriverClass(String driverClass) {
		this.driverClass = driverClass;
	}
	
	@Length(min=1, max=500, message="数据源连接字符串(JDBC)长度必须介于 1 和 500 之间")
	@ExcelField(title="数据源连接字符串(JDBC)", align=2, sort=3)
	public String getJdbcUrl() {
		return jdbcUrl;
	}

	public void setJdbcUrl(String jdbcUrl) {
		this.jdbcUrl = jdbcUrl;
	}
	
	@Length(min=1, max=50, message="数据源登录用户名长度必须介于 1 和 50 之间")
	@ExcelField(title="数据源登录用户名", align=2, sort=4)
	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}
	
	@Length(min=1, max=100, message="数据源登录密码长度必须介于 1 和 100 之间")
	@ExcelField(title="数据源登录密码", align=2, sort=5)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	@Length(min=1, max=100, message="获取报表引擎查询器类名长度必须介于 1 和 100 之间")
	@ExcelField(title="获取报表引擎查询器类名", align=2, sort=6)
	public String getQueryerClass() {
		return queryerClass;
	}

	public void setQueryerClass(String queryerClass) {
		this.queryerClass = queryerClass;
	}
	
	@Length(min=1, max=100, message="报表引擎查询器使用的数据源连接池类名长度必须介于 1 和 100 之间")
	@ExcelField(title="报表引擎查询器使用的数据源连接池类名", align=2, sort=7)
	public String getPoolClass() {
		return poolClass;
	}

	public void setPoolClass(String poolClass) {
		this.poolClass = poolClass;
	}
	
	@Length(min=1, max=1000, message="数据源配置选项(JSON格式）长度必须介于 1 和 1000 之间")
	@ExcelField(title="数据源配置选项(JSON格式）", align=2, sort=8)
	public String getOptions() {
		return options;
	}

	public void setOptions(String options) {
		this.options = options;
	}
	
}